include .env
export

.PHONY: swagger
swagger:
	@echo "Generate Swagger Document..."
	swag fmt
	swag init \
		--output internal/app/docs \
		--generalInfo cmd/app/app.go

.PHONY: app
app:
	@echo "Start ..."
	air app

.PHONY: asynq
asynq:
	@echo "Start ..."
	air asynq

.PHONY: asynqmon
asynqmon:
	@echo "Start ..."
	go run main.go asynqmon

.PHONY: app-ui
app-ui:
	@echo "Start default template ..."
	cd frontend/default-ui && npm run dev

.PHONY: build-appui
build-ui:
	@echo "Build default template ..."
	cd frontend/default-ui && rm -rf ../../resources/ui && npm run build && cp -rf dist/ ../../resources/ui/

.PHONY: prod
prod:
	@echo "Build production ..."
	rm -rf build
	mkdir -p build/resources
	go build -o build/app
	cd frontend/default-ui && npm run build 
	cp -rf frontend/default-ui/dist/ build/resources/ui
	cp -rf resources/ build/resources
	cp .env build/.env
	cp .env.screct build/.env.screct
	cp .env.oauth build/.env.oauth
	cp .env.upload build/.env.upload
	cp .env.mail build/.env.mail
